package cn.java76.spring1.printer2;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author oldliu
 * @since 1.0
 */
//新款打印机
@Service
public class Printer2 {
    @Value("惠普炫彩900系列")
    private String brand;//品牌
    @Value("999")
    private int price;//价格

    //@Resource
    @Autowired
    @Qualifier("ink")
    private Ink ink;

    @Resource(name = "a4")
    private Paper paper;
    public Printer2(){

    }

    public void print(String s){
        System.out.println("这个打印机的牌子是"+brand+",价格是"+price+"元");
        System.out.println("使用的墨水是"+ink.getColor());
        paper.print(s);//打印
    }
    //set不要了

//    public void setBrand(String brand) {
//        this.brand = brand;
//    }
//
//    public void setPrice(int price) {
//        this.price = price;
//    }
//
//    public void setInk(Ink ink) {
//        this.ink = ink;
//    }
//
//    public void setPaper(Paper paper) {
//        this.paper = paper;
//        System.out.println("设置纸张结束");
//    }
}
